/**
 * Created with IntelliJ IDEA.
 * User: ajhin
 * Date: 7/31/14
 * Time: 7:34 AM
 * To change this template use File | Settings | File Templates.
 */
package com.societyGames.utility
{
import flash.utils.Dictionary;

public class XMLDictionary
{
  private var _dictionary:Dictionary = new Dictionary(); //entry id -> XML

  public function XMLDictionary(entryXMLs:XMLList)
  {
    for each (var entryXML:XML in entryXMLs)
    {
      _dictionary[entryXML.@id.toString()] = entryXML.children()[0];
    }
  }

  public function lookUp(originalXML:XML):XML
  {
    var entryID:String = originalXML.@entry;
    if (entryID == null || entryID.length == 0)
    {
      return originalXML;
    }
    return _dictionary[entryID];
  }
}
}
